<?php
#基础函数
include_once('_path.php');

#db
include_once(_CONST_LOCAL_INCLUDE_PATH."database.class.php");
$database = new Database($db_vars);

if ($db_slave_vars['hostname'] != '') {
	$slave = new Database($db_slave_vars);
} else {
	$slave =& $database;
}

#通用函数
include_once(_CONST_LOCAL_INCLUDE_PATH."common.php");

#获取记录值
if(isset($_POST['ispost'])){
$name = trim($_POST['name']);
	$quote['name'] = string_sql($name);

$tel = trim($_POST['tel']);
	$quote['tel'] = string_sql($tel);

$email= trim($_POST['email']);
	$quote['email'] = string_sql($email);

$company= trim($_POST['company']);
	$quote['company'] = string_sql($company);
$service =  $_POST['service'];
if(is_array($service) && count($service)>0){
	$quote['service'] = string_sql(implode(' ', $service));
}else{
        $quote['service'] = string_sql($service);
}

$staff=intval( trim($_POST['staff']));
	$quote['staff'] = string_sql($staff);

$web= trim($_POST['web']);
	$quote['web'] = string_sql($web);

$address= trim($_POST['address']);
	$quote['address'] = string_sql($address);

$message= trim($_POST['message']);
	$quote['message'] = string_sql($message);

#插入数据
        $sql = "REPLACE INTO feedback (name, tel, email,company, service,staff,web,address,message) VALUES (".$quote['name'].", ".$quote['tel'].", ".$quote['email'].", ".$quote['company'].", ".$quote['service'].", ".$quote['staff'].", ".$quote['web'].", ".$quote['address'].", ".$quote['message'].");";
		$database->execute($sql);	
        if($database->getInsertId()>0){
            echo "<script>alert('反馈信息提交成功'); location.href = 'contacts-feedback.html';</script>";
        }
}
?>
